﻿@model  Admin.Models.UploadImageModel
@{
    ViewBag.Title = "Hình ảnh tải lên";
    if (ViewBag.Layout != null)
    {
        Layout = ViewBag.Layout;
    }
}
@section Styles
{
<link href="@Url.Content("~/Content/Media/ImageArea.css")" rel="stylesheet" />
}

@section Scripts
{ 
    
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")"></script> 
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.imgareaselect.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.fancyupload.js")"></script>
    <script>
        $(document).ready(function () {
            initSelect();
        });
    </script>
 
}
  
 
<h2>Hình ảnh tải lên</h2>
@using (Html.BeginForm("UploadImage", "Media", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.HiddenFor(model => model.X)
    @Html.HiddenFor(model => model.CateName)
    @Html.HiddenFor(model => model.Y)
    @Html.HiddenFor(model => model.Width)
    @Html.HiddenFor(model => model.Height)
    @Html.HiddenFor(model => model.Flickr)
    <div id="upload-choices">
         <div class="editor-row">
              <div class="editor-label">
            @Html.LabelFor(model => model.CateName)
            </div><div class="editor-field">
            @Html.DropDownList("CateId")
            </div> 
         </div>
         @Html.HiddenFor(e=>e.Id)
         <div class="editor-row">
              <div class="editor-label">
            @Html.LabelFor(model => model.Title)
            </div><div class="editor-field">
              @Html.TextBoxFor(model => model.Title)
            </div> 
         </div>
         <div class="editor-row">
              <div class="editor-label">
            @Html.LabelFor(model => model.Link)
            </div><div class="editor-field">
              @Html.TextBoxFor(model => model.Link)
            </div> 
         </div>
        <div class="editor-row">
            <div class="editor-label">
                @Html.EditorFor(model => model.IsUrl)
                @Html.LabelFor(model => model.Url)
            </div><div class="editor-field">
                @Html.EditorFor(model => model.Url)
                @Html.ValidationMessageFor(model => model.Url)
            </div>
        </div>
        <div class="editor-row">
            <div class="editor-label">
                @Html.EditorFor(model => model.IsFlickr)
                @Html.LabelFor(model => model.Flickr)
            </div><div class="editor-field">
                @Html.Editor("FlickrQuery")
                @Html.ValidationMessageFor(model => model.Flickr)
            </div>
        </div>
        <div class="editor-row">
            <div class="editor-label">
                @Html.EditorFor(model => model.IsFile)
                @Html.LabelFor(model => model.File)
            </div><div class="editor-field"> 
                 @Html.TextBoxFor(model => model.File, new { type = "file" })
                @Html.ValidationMessageFor(model => model.File)
            </div>
        </div>
        <div class="editor-row">
            @Html.ValidationSummary(true)
        </div>
    </div>
    <div id="upload-cut">
        <img alt="Lĩnh vực cắt hình ảnh" id="preview" src="@Url.Content("~/Content/Media/empty.png")" />
    </div>
    <div class="clear">
        <button type="submit">Tải lên</button>
    </div>
}